package spring.core.examples.xml;

import java.util.Locale;

import org.springframework.context.MessageSource;

/**
 * Demontrates how internationalization works using Spring and Java resource
 * bundles.
 */
public class Internationalization {
	private MessageSource messages;

	public void setMessages(MessageSource messages) {
		this.messages = messages;
	}

	@Override
	public String toString() {
		return messages.getMessage("error1", null, Locale.GERMAN)
				+ "\n"
				+ messages.getMessage("error1", null, Locale.US)
				+ "\n"
				+ messages.getMessage("error2", new Object[] { "trara" },
						Locale.GERMAN)
				+ "\n"
				+ messages.getMessage("error2", new Object[] { "trara" },
						Locale.US);
	}
}
